import { SceneConfig } from "./SceneConfig"
/**
 * 场景管理类
 * @author 神兽白泽
 * @description 交流群：415468592
 */
import { Component } from 'cc';
import * as cc from 'cc';
export default class GSceneMgr extends Component {
    /** 当前场景名 */
    private static cur_scene_name: string = null;
    /** 传递的参数 - 用完清空 */
    private static _load_data: any = null;
    public static set load_data(param: any) {
        this._load_data = param;
    }
    public static get load_data(): any {
        let temp_data = this._load_data;
        this._load_data = null;
        return temp_data;
    }
    /**
    * 加载场景
    * @param scene_name
    * @param param
    * @param call_back
    */
    public static loadScene(scene_name: keyof typeof SceneConfig, param?: any, call_back?: Function) {
        if (this.cur_scene_name == scene_name) {
            return;
        }
        this.cur_scene_name = scene_name;
        this.load_data = param;
        let complete_call = () => {
            call_back && call_back();
        }
        cc.director.loadScene(scene_name, complete_call);
    }
}